package com.kuang.a01threadcase1;

/**
 * @author gs
 * @date 29/5/2024 下午4:05
 */
public class ThreadDemo {


    /**
     * 多线程的第一种启动方式
     * 1、自定义一个类继承Thread类
     * 2、重写run方法
     * 3、创建子类对象，并启动线程
     *
     */

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        MyThread myThread2 = new MyThread();
        //Calls to 'run()' should probably be replaced with 'start()'
        //myThread1.run(); //这里不能直接用run
        myThread.setName("t1");
        myThread2.setName("thread2");
        myThread.start();
        myThread2.start();
    }
}
